#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 25;

int n, k;
string a[N];
int vis[N];
set<string> ans;
void dfs(vector<int>& path) {
  if (path.size() == k) {
    string res;
    for (int i : path) res += a[i];
    ans.insert(res);
    return;
  }
  for (int i = 1; i <= n; i++) {
    if (vis[i]) continue;
    vis[i] = 1;
    path.push_back(i);
    dfs(path);
    path.pop_back();
    vis[i] = 0;
  }
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> k;
  rep(i, 1, n) cin >> a[i];
  vector<int> path;
  dfs(path);
  cout << ans.size();
  return 0;
}